<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>定时发送详情</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
 		<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  		<link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
  		<link rel="stylesheet" href="../../public/res/css/g.css" />
  		<style>
  			.layui-form-label{width: 90px;}
  			.layui-input-block{margin-left: 125px;}
  			.layui-upload-img{width: 420px;height: 92px;margin: 0 10px 10px 0;}
  			.layui-table-link{text-decoration: underline;}
  			.layui-table-link:hover{color:#e18806;}
  		</style>
	</head>
	<body>
		<div class="layui-fluid">
			<div class="layui-card">
				<div class="layui-card-body" style="padding: 15px;">
					<form class="layui-form  layui-form-pane" action="" id="acceptor">
						<div class="layui-form-item"  pane="">
						  	<label class="layui-form-label">管理对象</label>
						    <div class="layui-input-block">
						    	<select name="interest" lay-filter="aihao">
							        <option value=""></option>
							        <option value="0">出租屋</option>
							        <option value="1">楼盘小区</option>
							        <option value="2">横沥牛行</option>
							        <option value="3">模具行业</option> 
							      </select>
						    </div>
						 </div>
						  <div class="layui-form-item" >
						  	<span>
						  		提示：信用评价标准的评价结果根据各项信用要素的总得分确定，以百分制为基础，由从高到低顺序对应A、B、C、D四等。
						  	</span>
						  </div>
						  <div class="layui-form-item" >
						  	<label class="layui-form-label">规则公式</label>
						    <div class="layui-input-block" pane="">
						    	<table  class="layui-table" width="613" border="0" cellpadding="2" cellspacing="1" id="SignFrame"  lay-filter="demo">
							       <tr id="trHeader">
							        <td width="27">序号</td>
							        <td width="64">等级</td>
							        <td width="86">最小值(包含)</td>
							        <td width="86">最大值</td>
							       <!-- <td width="86">操作</td>-->
							        <td width="57" align="center"> </td>
							       </tr>
							    </table>
						    </div>
						    <div>
							    <input class="layui-btn layui-btn-sm" type="button" name="Submit" value="添加" onclick="AddSignRow()" />
							   <input class="layui-btn layui-btn-sm" type="button" name="Submit2" value="清空" onclick="ClearAllSign()"/>
							   <input name='txtTRLastIndex' type='hidden' id='txtTRLastIndex' value="1" />
							  </div>
						  </div>
						  <div style="text-align: center;">
						  	<input class="layui-btn layui-btn-normal"  type="button"  lay-event="submit" value="确定" ></input>
						  </div>
					</form>
				</div>
			</div>
		</div>
		<script src="../../layuiadmin/layui/layui.js"></script> 
		<script type="text/javascript" src="js/layui-xtree.js" ></script>
		<script>
			//xtree数据结构
			    var json = [
			            {
			                title: "城管", value: "jd1", data: [
			                    { title: "吴静昌[13923310559]", value: "jd1.1", data: [] }
			                , { title: "林成添[13702358278]", value: "jd1.2", data: [] }
			                , { title: "梁剑辉[15918257701]", value: "jd1.3", data: [] }
			                , { title: "陈伟峰[13590865135]", value: "jd1.4", data: [] }
			                ]
			            }
			            , {
			                title: "网格办公室", value: "jd2", data: [ 
			                    { title: "刘焕芳[13528199669]", value: "jd2.2.1", data: [] }
			                        , { title: "吴建峰[13528182098]", value: "jd2.2.2", data: [] }
			                        , { title: "梁和平[13112929613]", value: "jd2.2.3", data: [] }
			                        , { title: "谭钊荣[13702792598]", value: "jd2.2.4", data: [] }
			                
			                ]
			            }
			    ];
				layui.use(['form','tree', 'layer','table','laydate'], function(){
				  	var form = layui.form;
				  	var table = layui.table;
				  	var laydate = layui.laydate;
				   	var layer = layui.layer,$ = layui.jquery; 
			   		//日期时间范围
				  	laydate.render({
				    	elem: '#test10'
				    	,type: 'datetime'
				    	,range: true
				  	});
			   		
			   		form.on('select(frequency)', function(data){
						if(data.value=="3"){
							$('[name="custom"]').removeClass('layui-hide')
						}else{
							$('[name="custom"]').addClass('layui-hide')
						}
					})
			   
				    //最完整的参数用法
			        var xtree3 = new layuiXtree({
			            elem: 'xtree3'                  //必填三兄弟之老大
			            , form: form                    //必填三兄弟之这才是真老大
			            , data: json  //必填三兄弟之这也算是老大
			            , isopen: false  //加载完毕后的展开状态，默认值：true
			            , ckall: true    //启用全选功能，默认值：false
			            , ckallback: function () { } //全选框状态改变后执行的回调函数
			            , icon: {        //三种图标样式，更改几个都可以，用的是layui的图标
			                open: "&#xe7a0;"       //节点打开的图标
			                , close: "&#xe622;"    //节点关闭的图标
			                , end: "&#xe621;"      //末尾节点的图标
			            }
			            , color: {       //三种图标颜色，独立配色，更改几个都可以
			                open: "#EE9A00"        //节点图标打开的颜色
			                , close: "#EEC591"     //节点图标关闭的颜色
			                , end: "#828282"       //末级节点图标的颜色
			            }
			            , click: function (data) {  //节点选中状态改变事件监听，全选框有自己的监听事件
			                console.log(data.elem); //得到checkbox原始DOM对象
			                console.log(data.elem.checked); //开关是否开启，true或者false
			                console.log(data.value); //开关value值，也可以通过data.elem.value得到
			                console.log(data.othis); //得到美化后的DOM对象
			            }
			        });

					$('[lay-event="AddSignRow"]').on('click', function() {
						AddSignRow();
					});
					$('[lay-event="ClearAllSign"]').on('click', function() {
						ClearAllSign();
					});
					
				});
				function findObj(theObj, theDoc) {
					var p, i, foundObj;
					if(!theDoc) theDoc = document;
					if((p = theObj.indexOf("?")) > 0 && parent.frames.length) {
						theDoc = parent.frames[theObj.substring(p + 1)].document;
						theObj = theObj.substring(0, p);
					}
					if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
					for(i = 0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj];
					for(i = 0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) foundObj = findObj(theObj, theDoc.layers[i].document);
					if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
					return foundObj;
				}
				//添加一个参与人填写行
				function AddSignRow() { //读取最后一行的行号，存放在txtTRLastIndex文本框中 
					var txtTRLastIndex = findObj("txtTRLastIndex", document);
					var rowID = parseInt(txtTRLastIndex.value);
					var signFrame = findObj("SignFrame", document);
					//添加行
					var newTR = signFrame.insertRow(signFrame.rows.length);
					newTR.id = "SignItem" + rowID;
					//添加列:序号
					var newNameTD = newTR.insertCell(0);
					//添加列内容
					newNameTD.innerHTML = newTR.rowIndex.toString();
					//添加列:姓名
					var newNameTD = newTR.insertCell(1);
					//添加列内容
					newNameTD.innerHTML = "<input name='txtName'" + rowID + "' id='txtName" + rowID + "' type='text' size='12' />";
					//添加列:手机
					var newMobileTD = newTR.insertCell(2);
					//添加列内容
					newMobileTD.innerHTML = "<input name='txtMobile'" + rowID + "' id='txtMobile" + rowID + "' type='text' size='12' />";
					//添加列:手机
					var newMaxTD = newTR.insertCell(3);
					//添加列内容
					newMaxTD.innerHTML = "<input name='txtMax'" + rowID + "' id='txtMax" + rowID + "' type='text' size='12' />";
//					//添加列:手机
//					var newOpeTD = newTR.insertCell(4);
//					//添加列内容
//					newOpeTD.innerHTML = "<select name='txtOpe'" + rowID + "' id='txtOpe" + rowID + "'><option value=""></option><option value='0'>通知</option><option value='1'>警告</option><option value='2'>公示</option><option value='3'>惩戒</option></select>";
					//添加列:删除按钮
					var newDeleteTD = newTR.insertCell(4);
					//添加列内容
					newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' style='color:#ff5722' onclick=\"DeleteSignRow('SignItem" + rowID + "')\">删除</a></div>";
					//将行号推进下一行
					txtTRLastIndex.value = (rowID + 1).toString();
				}
				//删除指定行
				function DeleteSignRow(rowid) {
					var signFrame = findObj("SignFrame", document);
					var signItem = findObj(rowid, document);
					//获取将要删除的行的Index
					var rowIndex = signItem.rowIndex;
					//删除指定Index的行
					signFrame.deleteRow(rowIndex);
					//重新排列序号，如果没有序号，这一步省略
					for(i = rowIndex; i < signFrame.rows.length; i++) {
						signFrame.rows[i].cells[0].innerHTML = i.toString();
					}
				} //清空列表
				function ClearAllSign() {
					if(confirm('确定要清空所有参与人吗？')) {
						var signFrame = findObj("SignFrame", document);
						var rowscount = signFrame.rows.length;
						//循环删除行,从最后一行往前删除
						for(i = rowscount - 1; i > 0; i--) {
							signFrame.deleteRow(i);
						}
						//重置最后行号为1
						var txtTRLastIndex = findObj("txtTRLastIndex", document);
						txtTRLastIndex.value = "1";
						//预添加一行
						AddSignRow();
					}
				}
				//关闭弹出层
				function closeDialog(){
				 	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
				 	console.log(parent.layer.config)
				    parent.layer.close(index);
				}
		</script>
	</body>
</html>
